package jutf8search;

import java.util.Vector;

/**
 * The interface for the Fuzzy Searching algorithms, such as Bitap and Counting
 * 
 *
 */
public interface FuzzySearchInterface {

	/**
	 * Preprocesses the byte[] query to make future searches faster.
	 * 
	 * @param query The query to be searched for.
	 */
	public void preprocess(byte[] query);

	/**
	 * Preprocesses the given string to speed up future searches.
	 * 
	 * @param query The query to be searched for.
	 */
	public void preprocess(String query);

	/**
	 * Finds the number of matches in the text which are within distance of the query.
	 * 
	 * @param text The byte[] to be searched.
	 * @param distance The number of mismatches allowed
	 * @return The number of matches found in the text as an int.
	 */
	public int numMatches(byte[] text, int distance);

	/**
	 * Returns the position of the matchNum<i>th</i> match in the text.
	 * 
	 * @param text The byte[] to be searched over.
	 * @param matchNum The number of the match that should be returned.
	 * @param distance The number of mismatches alllowed.
	 * @return The position in the byte[] of the match. 
	 */
	public int matchNum(byte[] text, long matchNum, int distance);

	/**
	 * Searches over the text and returns the positions of all the matches found.
	 * 
	 * @param text The byte[] to be searched over.
	 * @param distance The number of mismatches allowed.
	 * @return A Vector&lt;Long&gt; containing the positions in the text of the matches.
	 */
	public Vector<Long> fullSearch(byte[] text, int distance);

	/**
	 * Returns the length (in bytes) of the pattern that is being searched for.
	 * @return The length of the pattern in bytes as an int.
	 */
	public int getPatternSize();

	/**
	 * Resets the number of matches found over several iterations of the numMatches
	 * method.
	 * 
	 */
	public void resetMatch();
}
